///* @Date: 2022-06-07 13:19
///* @LastEditTime: 2022-06-16 09:54
///* @Description: 拦截器
///*/

import 'package:dio/dio.dart';
import 'package:flutter/material.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';

//Option拦截器可以用来统一处理Option信息 可以在这里添加
class OptionInterceptor extends InterceptorsWrapper {
  @override
  void onRequest(RequestOptions options, RequestInterceptorHandler handler) {
    String clientDeviceStr = "";

    //app版本

    options.headers["Content-Type"] = "application/json";
    debugPrint("options..headers:----> ${options.headers}");

    debugPrint(
      "request:---->${options.method}\t url-->${options.baseUrl}${options.path}?${options.queryParameters}",
    );

    if (options.queryParameters["hideLoading"] != true) {
      EasyLoading.show();
    }

    return handler.next(options);
  }
}
